package com.yaolisheng.service.impl;

import com.yaolisheng.service.PromTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @Company: 神州数码信息系统有限公司
 * @Author : yaols
 * @Date: 2022/10/08/15:48
 **/
@Service
public class PromTestServiceImpl implements PromTestService {

    @Resource
    private RestTemplate restTemplate;
    private static final String url = "http://10.0.44.50:9090/api/v1/query?query=up";

    @Override
    public String promQLHTTPAPI(String query) {
//        RestTemplate template = new RestTemplate();
        Map<String,String> map = new HashMap<String,String>();
        String forObject = restTemplate.getForObject(url, String.class, map);

        return forObject;
    }
}
